from YK_liushuai.Base.Base import Base
from selenium.webdriver.common.by import By
import time
class Page(Base):
    # 点击登录按钮
    dlogin_loc=(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dlogin(self):
        self.click(self.dlogin_loc)
    # 断言会员登录
    dy1_loc=(By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]')
    def dy1(self):
        return self.text(self.dy1_loc)
    # 输入用户名
    username_loc=(By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'13012558376')
    # 输入密码
    password_loc=(By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'123456Aa')
    # 点击登录按钮
    finishbtn_loc=(By.CLASS_NAME,'finish-btn')
    def finishbtn(self):
        self.click(self.finishbtn_loc)
    # 断言欢迎回来
    dy2_loc=(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dy2(self):
        return self.text(self.dy2_loc)


    def test_a3mall_login(self):
        self.dlogin()
        # self.dy1()
        # print("断言1：会员登录：",self.dy1())
        # assert "会员登录" == str(self.dy1())
        time.sleep(3)
        self.username()
        self.password()
        time.sleep(8)
        self.finishbtn()

        # self.dy2()
        # print("断言2：欢迎回来：",self.dy2())
        time.sleep(3)
